<template>
  <div
    style="display: flex; flex-direction: column; width: 100%; margin-top: 25px"
  >
    <div
      style="
        margin-bottom: 10px;
        background: #eee;
        line-height: 40px;
        padding-left: 5px;
      "
    >
      基本信息
    </div>
    <p-form-model
      :labelCol="{ span: 10 }"
      :wrapperCol="{ span: 14 }"
      ref="ruleForm"
      :model="form"
      :rules="rules"
      style="margin-top: 20px"
    >
      <p-row :guter="20">
        <p-col :span="12">
          <p-form-model-item ref="number" label="单据编号" prop="number">
            <p-input v-model="form.number" disabled />
          </p-form-model-item>
        </p-col>
        <p-col :span="12">
          <p-form-model-item ref="source" label="来源单号" prop="source">
            <p-input v-model="form.source" :disabled="listData.isNewAdd" />
          </p-form-model-item>
        </p-col>
        <p-col :span="12">
          <p-form-model-item ref="producer" label="制单人" prop="producer">
            <p-input-search
              class="hideName"
              :disabled="listData.isNewAdd"
              v-model="form.producer.name"
              @search="onSearchDepUser('producer')"
            >
              <p-button slot="enterButton" :disabled="disabled"
                >选择用户</p-button
              >
            </p-input-search>
          </p-form-model-item>
        </p-col>
        <p-col :span="12">
          <p-form-model-item ref="date" label="制单日期" prop="date">
            <p-date-picker
              v-model="defauvalue"
              @change="onChange"
              :disabled="listData.isNewAdd"
            />
          </p-form-model-item>
        </p-col>
        <p-col :span="12">
          <p-form-model-item ref="Company" label="更改单位" prop="Company">
            <p-select
              ref="Company"
              @change="handleChange"
              v-model="form.Company"
              :disabled="listData.isNewAdd"
            >
              <p-select-option :value="item.value" v-for="item in Company" :key="item.value">{{item.text}}</p-select-option>
            </p-select>
          </p-form-model-item>
        </p-col>
        <p-col :span="12">
          <p-form-model-item ref="type" label="更改类型" prop="type">
            <p-select v-model="form.type.text" disabled>
              <p-select-option
                @click="ValueChange(item)"
                :value="item.value"
                v-for="item in processChange"
                :key="item.value"
                >{{ item.text }}</p-select-option
              >
            </p-select>
          </p-form-model-item>
        </p-col>
        <p-col :span="12">
          <p-form-model-item ref="explain" label="更改来源说明" prop="explain">
            <p-input v-model="form.explain" :disabled="listData.isNewAdd" />
          </p-form-model-item>
        </p-col>
        <p-col :span="12">
          <p-form-model-item
            ref="Complete"
            label="更改物料齐套"
            prop="Complete"
          >
            <p-switch
              checked-children="是"
              un-checked-children="否"
              default-checked
              v-model="form.Complete"
              :disabled="listData.isNewAdd"
            />
          </p-form-model-item>
        </p-col>
        <p-col :span="12">
          <p-form-model-item
            ref="beforeNumber"
            label="更改前产品编码"
            prop="beforeNumber"
          >
            <p-input
              placeholder="请点击选择"
              v-model="form.beforeNumber"
              readonly
              @change="onChangeMaterialNo"
              ref="userNameInput"
              @click="openPop('before')"
              :disabled="listData.isNewAdd"
            >
              <p-icon slot="prefix" type="cluster" />
            </p-input>
          </p-form-model-item>
        </p-col>
        <p-col :span="12">
          <p-form-model-item
            ref="beforeName"
            label="更改前产品名称"
            prop="beforeName"
          >
            <p-input v-model="form.beforeName" :disabled="listData.isNewAdd" />
          </p-form-model-item>
        </p-col>
        <p-col :span="12">
          <p-form-model-item
            ref="afterNumber"
            label="更改后产品编码"
            prop="afterNumber"
          >
            <p-input
              placeholder="请点击选择"
              v-model="form.afterNumber"
              readonly
              ref="userNameInput"
              @click="openPop('after')"
              :disabled="listData.isNewAdd"
            >
              <p-icon slot="prefix" type="cluster" />
            </p-input>
          </p-form-model-item>
        </p-col>
        <p-col :span="12">
          <p-form-model-item
            ref="afterName"
            label="更改后产品名称"
            prop="afterName"
          >
            <p-input v-model="form.afterName" :disabled="listData.isNewAdd" />
          </p-form-model-item>
        </p-col>
        <p-col :span="12">
          <p-form-model-item
            ref="PlannerName"
            label="计划处理人"
            prop="PlannerName"
            :labelCol="{ span: 10 }"
          >
            <p-input-search
              class="hideName"
              :disabled="listData.isNewAdd"
              v-model="form.PlannerName"
              @search="onSearchDepUser('Planner')"
            >
              <p-button slot="enterButton" :disabled="disabled"
                >选择用户</p-button
              >
            </p-input-search>
          </p-form-model-item>
        </p-col>
        <p-col :span="12">
          <p-form-model-item
            ref="Craftsman"
            label="工艺处理人"
            prop="Craftsman"
            :labelCol="{ span: 10 }"
          >
            <p-input-search
              class="hideName"
              :disabled="listData.isNewAdd"
              v-model="form.Craftsman.name"
              @search="onSearchDepUser('Craftsman')"
            >
              <p-button slot="enterButton" :disabled="disabled"
                >选择用户</p-button
              >
            </p-input-search>
          </p-form-model-item>
        </p-col>
        <p-col :span="12">
          <p-form-model-item ref="main" label="工艺主管" prop="main">
              <p-input-search
              class="hideName"
              :disabled="listData.isNewAdd"
              v-model="form.main.name"
              @search="onSearchDepUser('main')">
              <p-button slot="enterButton" :disabled="disabled">选择用户</p-button>
              </p-input-search>
          </p-form-model-item>
      </p-col>
        <p-col :span="12">
          <p-form-model-item ref="manager" label="工艺经理" prop="manager">
              <p-input-search
              class="hideName"
              :disabled="listData.isNewAdd"
              v-model="form.manager.name"
              @search="onSearchDepUser('manager')">
              <p-button slot="enterButton" :disabled="disabled">选择用户</p-button>
              </p-input-search>
          </p-form-model-item>
      </p-col>
        <p-col :span="12">
          <p-form-model-item
            ref="Hardware "
            label="PCBA硬件升级"
            prop="Hardware"
              :labelCol="{ span: 10 }"
          >
            <p-switch
            :disabled="listData.isNewAdd"
              checked-children="是"
              un-checked-children="否"
              default-checked
              v-model="form.updata"
            />
          </p-form-model-item>
        </p-col>
        <p-col :span="12">
          <p-form-model-item
            ref="code "
            label="生产工单号"
            prop="code"
            :labelCol="{ span: 10 }"
          >
            <p-input
              v-model="form.code"
              :wrapperCol="{ span: 14 }"
              :disabled="listData.isNewAdd"
            />
          </p-form-model-item>
        </p-col>
        <p-col :span="14">
          <p-form-model-item
            label="产品更改内容"
            :labelCol="{ span: 6 }"
          >
            <p-select
              mode="multiple"
              style="width: 100%"
              v-model="form.list"
              :disabled="listData.isNewAdd"
            >
              <p-select-option
                :value="item.value"
                name="type"
                v-for="item in list"
                :key="item.value"
                >{{ item.text }}
              </p-select-option>
            </p-select>
          </p-form-model-item>
        </p-col>
        <p-col :span="5">
          <p-form-model-item
            label="工艺路线"
            :labelCol="{ span: 10 }"
          >
            <a href="javascript:;" :disabled="listData.isNewAdd" @click="handletemporary">差异物料指派表</a>
          </p-form-model-item>
        </p-col>
        <p-col :span="5">
          <p-form-model-item
            label="产品更改范围"
            :labelCol="{ span: 10 }"
          >
            <p-div>
              <a href="javascript:;" :disabled="listData.isNewAdd" @click="lockdetails">产品锁定单号明细</a>
            </p-div>
          </p-form-model-item>
        </p-col>
        <p-col :span="24">
          <p-form-model-item
            label="工艺更改操作说明"
            :labelCol="{ span: 3 }"
          >
            <p class="download" v-if="isShowDownload">
              <a @click="downloadFile">
                {{ upFileName }}
                <p-icon type="download" />下载
              </a>
              <a @click="resetUpload" :disabled="listData.isNewAdd">重新上传</a>
            </p>
            <p-upload
              v-else
              name="file"
              :action="url.upload"
              :data="data"
              accept=".rar,.zip,.doc,.docx,.pdf,.jpg"
              :fileList="fileList"
              :before-upload="beforeUpload"
              @change="changeFile"
            >
              <p-button> <a-icon type="upload" />上传文件 </p-button>
            </p-upload>
          </p-form-model-item>
        </p-col>
      </p-row>
    </p-form-model>
    <div v-show="isStatus">
          <div class="table-operator" style="text-align:right;margin-top:20px" v-show="this.listData.Approval">
            <p-button @click="saveButton" type="primary" :loading="btnLoading">保存</p-button>
            <p-button @click="submitButton" type="primary" :loading="btnLoading">提交</p-button>
        </div>
        <div class="table-operator" style="text-align:right;margin-top:20px" v-show="!this.listData.Approval">
            <p-button @click="confirm" type="primary" :loading="btnLoading">确认</p-button>
            <p-button @click="reject" type="primary" :loading="btnLoading">驳回</p-button>
        </div>
    </div>
    <!-- 差异物料指派表 -->
    <p-modal v-model="temporaryVisible" title @ok="temporaryOk" width="70%">
      <difference></difference>
    </p-modal>
    <!-- 产品锁定明细 -->
    <p-modal v-model="lockdetailsVisible" title @ok="lockdetailsOk" width="70%">
      <lockdetails></lockdetails>
    </p-modal>
    <!-- 产品编码列表 -->
    <p-modal
      v-model="nulberListVisible"
      title
      @ok="nulberListVisibleOk"
      width="70%"
    >
      <nulberListVisible @getNumber="getlist"></nulberListVisible>
    </p-modal>
    <!-- 人员选择模块 -->
    <j-select-user-by-dep-modal
      :ObjectList="ObjectList"
      ref="selectModal"
      :modal-width="1250"
      :multi="true"
      @ok="selectOK"
      @getName="getName"
      :user-ids="value"
      @initComp="initComp"
    />
  </div>
</template>
<script>
import Vue from "vue";
import mesPeProcess from "@/api/mesPeProcess";
import PageTitle from "@/components/PageTitle";
import drawRoute from "./handlePocess/drawRoute";
import { ajaxGetDictItems } from "@/api/api";
import {
  httpAction,
  putAction,
  api,
  getAction,
  postAction,
} from "@/api/manage";
import difference from "./difference";
import lockdetails from "./Lockdetails";
import JSelectUserByDepModal from "./JSelectUserByDepModal";
import moment from "moment";
import nulberListVisible from "./nulberListVisible";
export default {
  inject: ["userInfo"],
  components: {
    PageTitle,
    drawRoute,
    difference,
    lockdetails,
    JSelectUserByDepModal,
    nulberListVisible,
  },
  props: {
    listData: {
      type: Object,
      required: false,
    },
  },
  data() {
    return {
      moment,
      peo: "",
      list: [], //产品内容更改
      InventoryPackaging: [], //包材保留
      processChange: [], //更改类型
      Company:[],
      btnLoading:false,
      isStatus:true,
      temporaryVisible: false,
      changedetailsVisible: false,
      lockdetailsVisible: false,
      nulberListVisible: false,
      changeNumber: "",
      data: {
        bucketName: "mes",
        expireDate: 0,
      },
      fileList: [],
      isShowDownload: false,
      upFileName: "",
      accessoryUrl: "",
      defauvalue: moment(new Date(), "YYYY-MM-DD"),
      showFlag: false,
      idGetInfo: {},
      form: {
        type: {},
        producer: {},
        Planner: {},
        PlannerName: "",
        Craftsman: {},
        before: {},
        main:{},
        manager:{},
        beforeNumber: "",
        beforeName: "",
        afterName: "",
        afterNumber: "",
        Complete: false,
        updata: false,
        code: "",
      },
      rules: {
        source: [
          { required: true, message: "请填写来源单号", trigger: "blur" },
        ],
        producer: [
          { required: true, message: "请填写制单人", trigger: "blur" },
        ],
        Company: [
          { required: true, message: "请填写更改单位", trigger: "blur" },
        ],
        type: [
          { required: true, message: "请选择更改类型", trigger: "change" },
        ],
        explain: [
          { required: true, message: "请填写更改来源说明", trigger: "blur" },
        ],
        beforeNumber: [
          {
            required: true,
            message: "请填写更改前产品编码",
            trigger: "change",
          },
        ],
        beforeName: [
          {
            required: true,
            message: "请填写更改前产品名称",
            trigger: "change",
          },
        ],
        afterNumber: [
          {
            required: true,
            message: "请填写更改后产品编码",
            trigger: "change",
          },
        ],
        afterName: [
          {
            required: true,
            message: "请填写更改后产品名称",
            trigger: "change",
          },
        ],
        Craftsman: [
          { required: true, message: "请填写工艺处理人", trigger: "change" },
        ],
        planName: [
          { required: true, message: "请填写计划处理人", trigger: "change" },
        ],
        Material: [
          { required: true, message: "请选择包材保留", trigger: "change" },
        ],
        code: [
          { required: true, message: "请输入产品订单号", gtogger: "bler" },
        ],
      },
      url: {
        save: "/mes-craft/craft/mesPeBill", //"新增返工单"
        upload: api.test + "/poros-oss/file/upload",
      },
    };
  },
  computed: {
    handle() {
      return this.$route.query.handle;
    },
  },
  mounted() {
    this.lodacontent()
    if(this.listData.billStatus==6){this.isStatus=false}
    this.form.type = this.listData.typeChange;
    this.loadForm();
  },
  methods: {
    querylist() {
      if (this.listData.hand == "change") {
        let arr = this.listData.productChangeContent.split(",");
        let array = [];
        arr.forEach((item) => {
          array.push(
            this.list.filter((items) => {
              return items.value == item;
            })[0].value
          );
        });
        this.form.list = array;
      }
    },
    //   判断新增生成单据编号
    ifADD() {
      let param = {
        commonFormData: {},
        rules: [
          { ruleCode: "mes_ReturnDocument", columnName: "labelTemplateNo" },
        ],
      };
      putAction(api.ruleBaseURL, param).then((res) => {
        // 执行成功，获取返回的值，并赋到页面上
        if (res.code==0) {
        this.$set(this.form,'number',res.data.labelTemplateNo)
        }
      });
    },
    loadForm() {
        if (this.listData.hand == "add") {
          this.getnewDate();
          this.form.producer = {
            name: this.userInfo.empname,
            uid: this.userInfo.empno,
          };
          this.ifADD();
        } else if (this.listData.hand = "change") {
          this.setFormData(this.listData);
          this.nulberListVisibleOk();
        }
    },
    // 根据数据赋值给表单
    setFormData(data) {
      this.form.number = data.billNum;
      this.$set(this.form, "source", data.billOriNum);
      this.$set(this.form, "explain", data.productChangeExplain);
      this.$set(this.form, "code", data.produceOder);
      this.$set(this.form, "Company",  data.changeCompany)
      this.$set(this, "defauvalue", moment(data.createTime, "YYYY-MM-DD"));


      this.form.producer.uid = data.billCreate;
      this.form.producer.name = data.billCreateName;
      this.form.Complete = data.changeMaterialSet == "false" ? false : true;
      this.form.beforeNumber = data.productCodeChangeBefore;
      this.form.beforeName = data.productCodeChangeBeforeName;
      this.form.afterNumber = data.productCodeChangeAfter;
      this.form.afterName = data.productCodeChangeAfterName;
      this.form.Planner.uid = data.planProcessor;
      this.form.PlannerName = data.planProcessorName;
      this.form.Craftsman.uid = data.processEmployInfos[0].code;
      this.form.Craftsman.name = data.processEmployInfos[0].name;
      this.accessoryUrl = data.billExtraUrl;
      this.upFileName = data.billExtraName;
      this.form.main.uid=data.processSupervisor,
      this.form.main.name=data.processSupervisorName,
      this.form.manager.uid=data.processManager
      this.form.manager.name=data.processManagerName
      
      this.isShowDownload = true;
    },

    onChange(data, str) {
      this.form.data = str;
    },
    getlist(data) {
      if (this.changeNumber == "before") {
        this.form.beforeNumber = data[0].mcode;
        this.form.beforeName = data[0].mname;
      } else {
        this.form.afterNumber = data[0].mcode;
        this.form.afterName = data[0].mname;
      }
    },
    getnewDate() {
      // moment().format('YYYY-MM-DD')
      this.form.data = moment(new Date()).format("YYYY-MM-DD");
    },
    handletemporary() {
      this.temporaryVisible = true;
    },
    lockdetails() {
        this.lockdetailsVisible = true;
    },
    temporaryOk() {
      this.temporaryVisible = false;
    },
    lockdetailsOk() {
      this.lockdetailsVisible = false;
    },
    nulberListVisibleOk() {
      this.nulberListVisible = false;
    },
    openPop(data) {
      this.changeNumber = data;
      this.nulberListVisible = true;
    },
    selectOK(rows, idstr) {
      let arr = [];
      if (this.peo == "producer") {
        this.form.producer = rows;
      } else if (this.peo == "Planner") {
        this.form.Planner = rows;
        this.form.PlannerName = rows.name;
      } else if (this.peo == "manager") {
        this.form.manager = rows;
        this.form.managerName = rows.name;
      } else if (this.peo == "main") {
        this.form.main = rows;
        this.form.mainName = rows.name;
      }else if (this.peo == "Craftsman") {
        this.form.Craftsman = rows;
        this.form.CraftsmanName = rows.name;
      }
    },

    onSearchDepUser(value) {
      this.$refs.selectModal.showModal();
      this.peo = value;
    },
    //   加载数据字典
    lodacontent() {
      Promise.all([
        new Promise(resolve=>{
            ajaxGetDictItems("OutChange").then((res) => {
            if (res.code == 0) {
              resolve(res.data)
            } else {
              this.$message.error(res.msg);
            }
          });
        }),
         new Promise(resolve=>{
            ajaxGetDictItems("processChange").then((res) => {
            if (res.code == 0) {
              resolve(res.data)
            } else {
              this.$message.error(res.msg);
            }
          });
        }),
        new Promise(resolve=>{
            ajaxGetDictItems("mes_change_Company").then((res) => {
            if (res.code == 0) {
              resolve(res.data)
            } else {
              this.$message.error(res.msg);
            }
          });
        }),
      ]).then(res=>{
        this.list=res[0];
        this.processChange=res[1];
        this.Company=res[2];
        this.querylist()
      })
    },
    // 获取接口所需参数
    getObj(data, listid) {
      return {
        billNum: this.form.number, //单据号
        billOriNum: this.form.source, //来源单号
        billCreate: this.form.producer.uid, //制单人
        billCreateName: this.form.producer.name, //制单人名称
        changeCompany: this.form.Company, //更改单位
        changeType: this.form.type.value.toString(), //更改类型
        productChangeExplain: this.form.explain, //更改来源说明
        changeMaterialSet: this.form.Complete.toString(), //是否齐套
        productCodeChangeBefore: this.form.beforeNumber, //更改前编码
        productCodeChangeAfter: this.form.afterNumber, //更改后编码
        planProcessor: this.form.Planner.uid, //计划处理人
        planProcessorName: this.form.Planner.name, //计划处理人名称
        processProcessor: this.form.Craftsman.uid, //工艺处理人
        productChangeContent: this.form.list.toString(), //产品更改内容
        pcbaUpgrade: this.form.updata.toString(), //硬件升级
        produceOder: this.form.code, //生产订单号
        billExtraUrl: this.accessoryUrl, //附件链接
        billExtraName: this.upFileName,
        processSupervisor:this.form.main.uid,
        processSupervisorName:this.form.main.name,
        processManager:this.form.manager.uid,
        processManagerName:this.form.manager.name,
        billStatus: data,
        id: listid,
      };
    },
    saveButton() {
      if (!this.listData.isNewAdd) {
        this.$refs.ruleForm.validate((valid) => {
          if (valid) {
            if (this.listData.hand == "add") {
                this.btnLoading = true;
              postAction(this.url.save, this.getObj(0)).then((res) => {
                if (res.code == 0) {
                  this.$message.success("保存成功");
                    this.btnLoading = false;
                  this.$emit("closeoutReworkVisible");
                } else {
                  this.$message.error(res.msg);
                }
              });
            } else if (this.listData.hand == "change") {
                this.btnLoading = true;
              putAction(this.url.save, this.getObj(0, this.listData.id)).then(
                (res) => {
                  if (res.code == 0) {
                    this.$message.success("修改成功");
                    this.btnLoading = false;
                    this.$emit("closeoutReworkVisible");
                  } else {
                    this.$message.error(res.msg);
                  }
                }
              );
            }
          }
        });
      }
    },
    submitButton() {
      if (!this.listData.isNewAdd) {
        this.$refs.ruleForm.validate((valid) => {
          if (valid) {
              if (this.listData.hand == "add") {
                this.btnLoading = true;
                   postAction(this.url.save, this.getObj(1)).then((res) => {
                    if (res.code == 0) {
                      this.$message.success("提交成功");
                      this.btnLoading = false;
                      this.$emit("closeoutReworkVisible");
                    } else {
                      this.$message.error(res.msg);
                    }
                  });
              }else if(this.listData.hand=='change'){
                this.btnLoading = true;
                putAction(this.url.save, this.getObj(1, this.listData.id)).then(
                  (res) => {
                    if (res.code == 0) {
                      this.$message.success("提交成功");
                      this.btnLoading = false;
                      this.$emit("closeoutReworkVisible");
                    } else {
                      this.$message.error(res.msg);
                    }
                  }
                );
              }



           
          }
        });
      }
      console.log("提交");
    },
    // 忘记上传前
    beforeUpload(file, fileList) {
      //   .rar,.zip,.doc,.docx,.pdf,.jpg
      if (
        file.name.indexOf(".rar") > 0 ||
        file.name.indexOf(".zip") > 0 ||
        file.name.indexOf(".doc") > 0 ||
        file.name.indexOf(".docx") > 0 ||
        file.name.indexOf(".pdf") > 0 ||
        file.name.indexOf(".jpg") > 0
      ) {
        this.upFileName = file.name;
        return true;
      } else {
        this.$message.error("支持扩展名：.rar .zip .doc .docx .pdf .jpg");
        return false;
      }
    },
    changeFile(info) {
      this.fileList = [...info.fileList];
      // 上传文件
      if (info.file.status !== "uploading") {
      }
      if (info.file.status === "done") {
        this.$message.success(`${info.file.name} 上传成功`);
        this.isShowDownload = true;
        this.accessoryUrl = info.file.response.data;
      } else if (info.file.status === "error") {
        this.$message.error(`${info.file.name} 上传失败.`);
      }
    },
    downloadFile() {
      window.open(this.accessoryUrl);
    },
    resetUpload() {
      this.isShowDownload = false;
      this.$set(this, "accessoryUrl", "");
      this.$set(this, "accessoryName", "");
      this.fileList = [];
    },

    // 审批通过函数
    confirm(){
      let statues=this.listData.billStatus
      if(statues==1){
        if(this.screen(this.form.Craftsman.uid[1]) ||this.screen(this.form.producer.uid)){
          this.saveSubmit(2,'审批成功')
        }else{
          this.$message.error('暂无权限确认')
        }
      }else if(statues==2){
        if(this.screen(this.form.Planner.uid)){
          this.saveSubmit(4,'审批成功')
        }else{
          this.$message.error('暂无权限确认')
        }
      }else if(statues==4){
        if(this.screen(this.form.main.uid)){
          this.saveSubmit(5,'审批成功')
        }else{
          this.$message.error('暂无权限确认')
        }
      }else if(statues==5){
        if(this.screen(this.form.manager.uid)){
        this.saveSubmit(6,'审批成功')
        }else{
          this.$message.error('暂无权限确认')
        }
      }
    },
    // 驳回
    reject(){
      let statues=this.listData.billStatus
      console.log(statues)
      if(statues==1){
        if(this.screen(this.form.Craftsman.uid[1]) ||this.screen(this.form.producer.uid)){
          this.saveSubmit(0,'驳回成功')
        }else{
          this.$message.error('暂无权限驳回')
        }
      }else if(statues==2){
        if(this.screen(this.form.Planner.uid)){
          this.saveSubmit(0,'驳回成功')
        }else{
          this.$message.error('暂无权限驳回')
        }
      }else if(statues==4){
        if(this.screen(this.form.main.uid)){
          this.saveSubmit(0,'驳回成功')
        }else{
          this.$message.error('暂无权限驳回')
        }
      }else if(statues==5){
        if(this.screen(this.form.manager.uid)){
        this.saveSubmit(0,'驳回成功')
        }else{
          this.$message.error('暂无权限驳回')
        }
      }
    },
    // 判断当前登录人工号是否为目标工号
    screen(data){
      if(this.userInfo.empno==data){
        return true
      }else{
        return false
      }
    },
    // 保存编辑函数
    saveSubmit(data,test){
      this.btnLoading = true;
      putAction(this.url.save, this.getObj(data,this.listData.id)).then((res) => {
        if (res.code == 0) {
          this.$message.success(test);
           this.btnLoading = false;
            this.$emit('closeoutReworkVisible')
        } else {
          this.$message.error(res.msg);
        }
      });
    },
  },
};
</script>
<style  scoped>
.poros-form .poros-form-item {
  height: 42px;
}
</style>